package com.ghca.springdata.service;

import com.ghca.springdata.entity.Student;
import com.ghca.springdata.repository.StudentRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.logging.LogLevel;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by gh on 2016/10/25.
 */

@Service
public class MyService {

    private static Logger LOG = LoggerFactory.getLogger(MyService.class);

    @Autowired
    private StudentRepository studentRepository;

    @Transactional
    public void doService()  {
        System.out.println("=========");
        List<Student> list = studentRepository.findAll();
        System.out.println(list);
        LOG.warn("before SLEEP========");
        Student student = studentRepository.findByName("zhang");
        LOG.warn("after SLEEP========");


    }
}
